/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package player.model;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.Time;

/**
 * Pokrenuto stanje plejera
 * @author Andrej
 */
public class PlayState implements PlayerState
{
    private PlayerImpl player;

    /**
     * Konstruktor
     * @param player plejer kojem ovo stanje pripada
     */
    public PlayState(PlayerImpl player)
    {
        this.player = player;
    }

    public void play()
    {
        
    }

    public void stop()
    {
        try
        {
            player.getMediaPlayer().stop();
            player.getMediaPlayer().setMediaTime(new Time(0));
            player.setState(new StoppedState(player));
            player.playbackStopped();
            
        } catch (Exception ex)
        {
            Logger.getLogger(PlayState.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void pause()
    {
        player.setState(new PausedState(player));
        player.getMediaPlayer().stop();
        player.playbackPaused();
    }

}
